package com.dg11185.nearshop.net.response;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 
 * @author：Daibo    
 * @time：2014-5-26 下午2:16:47
 */
public class JobTypeResponse {

    public Map<String, String> maps;

    public List<JobType> lists;
    
    public JobTypeResponse() {
        maps = new HashMap<String, String>();
        lists = new ArrayList<JobTypeResponse.JobType>();
    }

    public void parseJson(String response) {
        try {

            JSONArray areaArray = new JSONArray(response);
            for (int a = 0; a < areaArray.length(); a++) {
                JobType type = new JobType();
                type.parseEntity(areaArray.getJSONObject(a));
                lists.add(type);
                maps.put(type.key, type.value);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public class JobType {
        public String key = "";

        public String value = "";

        public void parseEntity(JSONObject object) {

            key = object.optString("val");
            value = object.optString("name");
        }

    }
}
